<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                template="/WEB-INF/layout/base.xhtml">
    <ui:define name="title">Goodwill Catalog on-line</ui:define>
    <ui:define name="content">
       <ui:include src="status.xhtml" /> <!--  Отрубить для отчуждаемой копии-->

        <a4j:form id="jsForm">
            <a4j:jsFunction name="selectMotor"
                            action="#{SearchAutoBean.updateFilters}"
                            ajaxSingle="true"
                            limitToList="true"
                            reRender="dvFiltersTable,dvMotorsTable">
                <a4j:actionparam name="motorId" assignTo="#{SearchAutoBean.selectedMotorId}"/>
            </a4j:jsFunction>

            <a4j:jsFunction name="showFoto"
                            action="#{SearchAutoBean.showFoto}"
                            ajaxSingle="true"
                            limitToList="true">
                <a4j:actionparam name="filterId" assignTo="#{SearchAutoBean.selectedFilterId}"/>
            </a4j:jsFunction>

            <a4j:jsFunction name="showApplication"
                            action="#{SearchAutoBean.showApplication}"
                            ajaxSingle="true"
                            limitToList="true">
                <a4j:actionparam name="filterId" assignTo="#{SearchAutoBean.selectedFilterId}"/>
            </a4j:jsFunction>

            <a4j:jsFunction name="showAnalogs"
                            action="#{SearchAutoBean.showAnalogs}"
                            ajaxSingle="true"
                            limitToList="true">
                <a4j:actionparam name="filterId" assignTo="#{SearchAutoBean.selectedFilterId}"/>
            </a4j:jsFunction>

            <a4j:jsFunction name="setSelectedTab"
                            ajaxSingle="true"
                            limitToList="true"
                            status="">
                <a4j:actionparam name="tabId" assignTo="#{TabsBean.selectedTab}"/>
            </a4j:jsFunction>
        </a4j:form>

        <h:panelGroup id="dvTabs">
            <rich:tabPanel switchType="client" selectedTab="#{TabsBean.selectedTab}">
                <rich:tab name="searchAutoTab" label="#{mainMsg.searchAuto}"
                          ontabenter="setSelectedTab('searchAutoTab')">
                    <a4j:include viewId="/pages/searchAuto/searchAuto.xhtml"/>
                </rich:tab>
                <rich:tab name="crossReferenceTab" label="#{mainMsg.crossReference}"
                          ontabenter="setSelectedTab('crossReferenceTab')">
                    <a4j:include viewId="/pages/crossReference/crossReference.xhtml"/>
                </rich:tab>
                <rich:tab name="goodwillGoodTab" label="#{mainMsg.goodwillGood}"
                          ontabenter="setSelectedTab('goodwillGoodTab')">
                    <a4j:include viewId="/pages/goodwillGood/goodwillGood.xhtml"/>
                </rich:tab>
                <rich:tab name="searchSizeTab" label="#{mainMsg.searchSize}"
                          ontabenter="setSelectedTab('searchSizeTab')">
                    <a4j:include viewId="/pages/searchSize/searchSize.xhtml"/>
                </rich:tab>
                <rich:tab name="unloadingByBrandTab" label="#{mainMsg.unloadingByBrand}"
                          ontabenter="setSelectedTab('unloadingByBrandTab')" rendered="false">
                    <a4j:include viewId="/pages/unloadingByBrand/unloadingByBrand.xhtml"/>
                </rich:tab>
            </rich:tabPanel>
        </h:panelGroup>

    </ui:define>
</ui:composition>